﻿using System.ComponentModel.Composition;
using System.Net;
using System.Net.Http;

namespace Neo4jConnect.Rest.Extensions.Sample
{
    [Neo4jExtension("GetAll")]
    [Export(typeof(INeo4jExtension))]
    public class GetAllExtension : Neo4jExtensionBase
    {        
        public GetAllExtension(HttpClient client) : base("GetAll", client)
        {
        }

        public string GetAllNodes()
        {                        
            return Client
                .Post("ext/GetAll/graphdb/get_all_nodes", new StringContent(string.Empty))
                .EnsureStatusCode(HttpStatusCode.OK)
                .Content.ReadAsString();            
        }

        public string GetAllRelationships()
        {
            return Client
                .Post("ext/GetAll/graphdb/getAllRelationships", new StringContent(string.Empty))
                .EnsureStatusCode(HttpStatusCode.OK)
                .Content.ReadAsString();
        }
    }
}
